<template>
  <div class="news-list newlist-style2">
    <ul class="list" v-if="newsInfo.length">
      <li class="news-item" v-for="item in newsInfo" :key="item.id" @click="handleDetail(item.id)">
        <a>
          <div class="news-body">
            <h5 class="news-title">
              {{item.title}}
            </h5>
            <div class="news-props">
              <time class="news-pubdate">{{item.addtime}}</time>
            </div>
          </div>
          <div class="news-img">
            <img
              :src="item.picurl"
              class="media-object img-responsive"
              alt=""
            />
          </div>
        </a>
      </li>
    </ul>
    <van-empty description="暂无数据" v-else />
  </div>
</template>

<script>
import common from '@/mixins/index';
export default {
  mixins: [common],
  props: ['newsInfo'],
  data() {
    return {
    };
  },
};
</script>

<style lang="less">
.list {
  list-style: none;
  padding: 0;
}
.news-list {
  padding: 0 0;
  .news-item {
    position: relative;
    border-bottom: 1px solid #ededed;
    overflow: hidden;
    .news-img {
      width: 3.306667rem;
      height: 1.866667rem;
      -ms-flex-preferred-size: 3.306667rem;
      flex-basis: 3.306667rem;
      img {
        width: 100%;
        height: 100%;
      }
    }
    a {
      font-size: 0.373333rem;
      overflow: hidden;
      white-space: nowrap;
      -o-text-overflow: ellipsis;
      text-overflow: ellipsis;
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      -ms-flex-pack: distribute;
      justify-content: space-around;
      -ms-flex-wrap: nowrap;
      flex-wrap: nowrap;
    }
    .news-body {
      -webkit-box-flex: 1;
      -ms-flex-positive: 1;
      flex-grow: 1;
      display: flex;
      justify-content: space-around;
      flex-direction: column;
      overflow: hidden;
      height: 1.866667rem;
      width: 0;
      .news-title {
        font-size: 0.373333rem;
        font-weight: 700;
        line-height: 1.5;
        text-align: justify;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        white-space: normal;
        padding-right: 0.266667rem;
      }
      .news-props {
        margin-top: 0.066667rem;
        font-size: 0.373333rem;
        line-height: 1.5;
        color: #999;
        .news-pubdate {
          margin-right: 0.5em;
        }
      }
    }
  }
}
</style>